﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="pgJRecepcionProceso.aspx.cs" Inherits="EGuayas.Web.EGlobal.pgJefeDepart" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register Src="~/EGlobal/ucInfoDocumentos.ascx" TagPrefix="uc1" TagName="ucInfoDocumentos" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link  href="~/Resources/css/Style.css"  rel="stylesheet" />
    <!-- Load Ext JS --> 
    <script src="../../Resources/js/Global.js"></script>
   
</head>
<body>  
    <form id="Form1" runat="server"> 
        <ext:ResourceManager ID="pgIdCategManager" runat="server" />
        <uc1:ucInfoDocumentos runat="server" id="ucInfoDocumentos" />
        <ext:Viewport ID="Viewport1" runat="server" Layout="BorderLayout">
            <Items>  
              <ext:FormPanel ID="FormPanel4" runat="server" Region="Center" Layout="VBoxLayout">
                <LayoutConfig>
                    <ext:VBoxLayoutConfig Align="Stretch" />
                </LayoutConfig> 
                   <Items>
                        <ext:Hidden Text="" ID="hdGlobalJefatura" Name="GlobalJefatura" runat="server"></ext:Hidden>        
                        <%--:: Venana popup --%>
                        <ext:Window
                        ID="winProceso"
                        runat="server"
                        Height="500"
                        Width="850"
                        ButtonAlign="Center"
                        BodyStyle="background-color: #fff;"
                        BodyPadding="5"
                        Hidden="true"
                        CloseAction="Hide"
                        Plain="true"                 
                        HeaderPosition="Bottom"
                        Layout="BorderLayout">
                        <Items> 
                             <ext:FormPanel
                                ID="forPanelProc"
                                Region="Center"
                                Split="true"
                                runat="server" 
                                Border="false"                             
                                BodyPadding="5"                              
                                Layout="FitLayout">
                                <FieldDefaults LabelWidth="75" LabelPad="20" LabelSeparator="" />
                                <Items>
                                    <ext:Panel ID="Panel3" runat="server" Border="false" Layout="Form" ColumnWidth=".5" LabelAlign="Top">
                                        <Defaults>                     
                                        </Defaults>
                                        <Items>       
                                            <ext:Hidden Text="" ID="hdId" Name="Id" runat="server"></ext:Hidden>
                                            <ext:UserControlLoader ID="uc_tareas_J001" UserControlID="wuc_tarea_borrador_j001" runat="server" Path="~/EGlobal/wucTareas.ascx"  /> 
                                        </Items>                     
                                     </ext:Panel>
                                </Items>
                                <Listeners>
                                    <ValidityChange Handler="#{btnAprobar}.setDisabled(!valid);" />
                                </Listeners>
                            </ext:FormPanel>
                        </Items>
                        <Buttons>
                            <ext:Button ID="btnAprobar" runat="server" Text="Aceptar" Disabled="true"  
                                FormBind="true">
                                <DirectEvents>                       
                                    <Click OnEvent="btnAceptar_Click" After="AppGlobalJs.closeWin(#{winProceso})">
                                        <ExtraParams>
                                            <ext:Parameter Name="Id" Value="#{hdId}.getValue()" Mode="Raw" />                               
                                        </ExtraParams>
                                        <EventMask ShowMask="true"></EventMask>                         
                                    </Click>                        
                                </DirectEvents>
                            </ext:Button>
                            <ext:Button ID="btnCancelar" runat="server" Text="Cancelar" OnClientClick="AppGlobalJs.closeWin(#{winProceso})">
                                <Listeners>
                                </Listeners>
                            </ext:Button>
                        </Buttons>
                        <Listeners>
                            <BeforeHide Handler="#{forPanelProc}.getForm().reset();"></BeforeHide>
                        </Listeners>
                    </ext:Window>
        <ext:TabPanel ID="TabPanel1" runat="server"  Flex="1">
                <Items>
                     <ext:FormPanel ID="FormPanel1" runat="server" Region="Center" Layout="Fit"     Title  ="Documentos a Revizar" 
                                    Icon        ="PageWhiteStack" >                           
                                    <Items>  
                             
                                                <ext:GridPanel
                                                    ID="gpDocumentosLoad"
                                                    runat="server"                                           
                                                    Height="90">
                                                    <Store>
                                                        <ext:Store ID="Store2" runat="server">
                                                            <Model>
                                                                <ext:Model ID="Model2" runat="server" IDProperty="Id">
                                                                    <Fields>
                                                                        <ext:ModelField Name="Fecha" Type="Date" />
                                                                        <ext:ModelField Name="ExpedienteId" Type="String" />
                                                                        <ext:ModelField Name="ExpedienteNombre" Type="String" />
                                                                        <ext:ModelField Name="FaseNombre" Type="String" />
                                                                        <ext:ModelField Name="FaseId" Type="String" />
                                                                        <ext:ModelField Name="JefeturaNombre" Type="String" />
                                                                        <ext:ModelField Name="JefeturaCodigo" Type="String" /> 
                                                                        <ext:ModelField Name="FaseCodigo" Type="String" />                                                                      
                                                                        <ext:ModelField Name="FaseId" Type="String" />
                                                                        <ext:ModelField Name="EstadoFase" Type="String" />  
                                                                        <ext:ModelField Name="Tabla" Type="String" />
                                                                        <ext:ModelField Name="TablaId" Type="String" />   
                                                                        <ext:ModelField Name="Instruccion" Type="String" />           
                                                                    </Fields>
                                                                </ext:Model>
                                                            </Model>                                      
                                                            <Proxy>
                                                                <ext:PageProxy DirectFn="App.direct.BindDataProcesos">                                                              
                                                                    <Reader>
                                                                        <ext:JsonReader></ext:JsonReader>
                                                                    </Reader>
                                                                </ext:PageProxy>
                                                            </Proxy>
                                                        </ext:Store>
                                                    </Store>
                                                    <ColumnModel ID="ColumnModel2" runat="server">
                                                        <Columns>
                                                            <ext:Column ID="Column1"  runat="server" Text="Id" DataIndex="Id" Flex="1" Hidden="true"/>
                                                            <ext:DateColumn ID="DateColumn3" runat="server" Text="Fecha" Width="95" DataIndex="Fecha" Format="dd-m-yy" />                                                        
                                                            <ext:Column  runat="server" Text="Expediente" DataIndex="ExpedienteNombre" Flex="1"/>
                                                            <ext:Column  runat="server" Text="Fase" DataIndex="FaseNombre" /> 
                                                            <ext:Column  runat="server" Text="Instrucción" DataIndex="Instruccion" /> 
                                                            <ext:Column ID="Column11" runat="server">
                                                                <Commands>
                                                                    <ext:ImageCommand CommandName="RevApro" Icon="PageWhiteRefresh" Text="Documentos">                                                                
                                                                    </ext:ImageCommand>
                                                                </Commands>
                                                               
                                                                <Listeners>
                                                                    <Command Handler="pgFn.ShwoAllDoc(record);"></Command>
                                                                </Listeners>
                                                            </ext:Column>                                                               
                                                            <ext:Column ID="Column12" runat="server" Weight="150">
                                                                <Commands>
                                                                    <ext:ImageCommand CommandName="RevApro" Icon="ApplicationEdit" Text="Asignar Tarea"  >                                                                
                                                                    </ext:ImageCommand>
                                                                </Commands>                                                               
                                                                <Listeners>
                                                                    <Command Handler="pgFn.ShowProc(record);"></Command>
                                                                </Listeners>
                                                            </ext:Column>                                                             
                                                            <ext:Column ID="Column6" runat="server" Weight="205">   
                                                               <Commands>
                                                                    <ext:ImageCommand CommandName="VerExp" Icon="ZoomOut" Text="Devolver proceso">                                                                
                                                                    </ext:ImageCommand>
                                                                </Commands>                                                               
                                                                <Listeners>
                                                                    <Command Handler="pgFn.DevolverProce(record);"></Command>
                                                                </Listeners>
                                                            </ext:Column>                                                                              
                                                        </Columns>                                                    
                                                    </ColumnModel>  
                                                    <Features>
                                                            <ext:GridFilters runat="server" ID="GridFilters1" Local="true" MenuFilterText="Filtrar por">
                                                                <Filters>
                                                                    <ext:StringFilter DataIndex="ExpedienteNombre"  EmptyText="Nombre"/>
                                                                    <ext:StringFilter DataIndex="FaseNombre" EmptyText="Fase"/>
                                                                    <ext:DateFilter   DataIndex="Fecha" AfterText="Despues de" BeforeText="Antes de"  OnText="En" >
                                                                        <DatePickerOptions runat="server" TodayText="Ahora" />
                                                                    </ext:DateFilter>                                                          
                                                                </Filters>
                                                            </ext:GridFilters>
                                                    </Features>                                                                                                             
                                                </ext:GridPanel>                                                  
                          
                                    </Items>
                       
                           <BottomBar>
                             <ext:StatusBar 
                                    ID="StatusBar2" 
                                    runat="server"
                                    StatusAlign="Left">
                                    <Items>                                
                                        <ext:ToolbarTextItem ID="ToolbarTextItem1" runat="server" Text="" Cls="ux-bold-text-item"  Margin="15"/>
                                    </Items>
                                </ext:StatusBar>
                            </BottomBar>
                    </ext:FormPanel>
                     <ext:FormPanel ID="FormPanel2" runat="server" Region="Center" Layout="Fit"  Title  ="Documentos Enviados" 
                                Icon        ="BookOpenMark" >                       
                                <Items>                                    
                             
                                            <ext:GridPanel
                                                ID="gpEnviados"
                                                runat="server"                                           
                                                Height="90">
                                                 <Store>
                                                        <ext:Store ID="Store1" runat="server">
                                                            <Model>
                                                                <ext:Model ID="Model1" runat="server" IDProperty="Id">
                                                                    <Fields>
                                                                        <ext:ModelField Name="Fecha" Type="Date" />
                                                                        <ext:ModelField Name="ExpedienteId" Type="String" />
                                                                        <ext:ModelField Name="ExpedienteNombre" Type="String" />
                                                                        <ext:ModelField Name="FaseNombre" Type="String" />
                                                                        <ext:ModelField Name="FaseId" Type="String" />
                                                                        <ext:ModelField Name="JefeturaNombre" Type="String" />
                                                                        <ext:ModelField Name="JefeturaCodigo" Type="String" /> 
                                                                        <ext:ModelField Name="FaseCodigo" Type="String" />
                                                                        <ext:ModelField Name="FaseLicId" Type="String" />
                                                                        <ext:ModelField Name="FaseId" Type="String" />
                                                                        <ext:ModelField Name="EstadoFase" Type="String" />  
                                                                        <ext:ModelField Name="ListaTecnicos" Type="String" />                                                              
                                                                    </Fields>
                                                                </ext:Model>
                                                            </Model>                                      
                                                            <Proxy>
                                                                 <ext:PageProxy DirectFn="App.direct.BindDataEnviados">
                                                                    <Reader>
                                                                        <ext:JsonReader></ext:JsonReader>
                                                                    </Reader>
                                                                </ext:PageProxy>
                                                            </Proxy>
                                                        </ext:Store>
                                                    </Store>
                                                    <ColumnModel ID="ColumnModel1" runat="server">
                                                        <Columns>
                                                            <ext:Column ID="Column2"  runat="server" Text="Id" DataIndex="Id" Flex="1" Hidden="true"/>
                                                            <ext:DateColumn ID="DateColumn1" runat="server" Text="Fecha" Width="95" DataIndex="Fecha" Format="dd-m-yy" />                                                        
                                                            <ext:Column ID="Column3"  runat="server" Text="Expediente" DataIndex="ExpedienteNombre" />
                                                            <ext:Column ID="Column4"  runat="server" Text="Fase" DataIndex="FaseNombre" /> 
                                                            <ext:Column ID="Column9"  runat="server" Text="Técnicos" DataIndex="ListaTecnicos" Flex="1"/>                                                       
                                                        </Columns>                                                    
                                                    </ColumnModel>  
                                                     <Features>
                                                            <ext:GridFilters runat="server" ID="GridFilters2" Local="true" MenuFilterText="Filtrar por">
                                                                <Filters>
                                                                    <ext:StringFilter DataIndex="ExpedienteNombre"  EmptyText="Nombre"/>
                                                                    <ext:StringFilter DataIndex="FaseNombre" EmptyText="Fase"/>
                                                                    <ext:DateFilter   DataIndex="Fecha" AfterText="Despues de" BeforeText="Antes de"  OnText="En" >
                                                                        <DatePickerOptions runat="server" TodayText="Ahora" />
                                                                    </ext:DateFilter>                                                            
                                                                   
                                                                </Filters>
                                                            </ext:GridFilters>
                                                    </Features> 
                                            </ext:GridPanel>
                                          
                          
                                </Items>
                       
                       <BottomBar>
                         <ext:StatusBar 
                                ID="StatusBar1" 
                                runat="server"
                                StatusAlign="Left">
                                <Items>                                
                                    <ext:ToolbarTextItem ID="ToolbarTextItem2" runat="server" Text="" Cls="ux-bold-text-item"  Margin="15"/>
                                </Items>
                            </ext:StatusBar>
                        </BottomBar>
           </ext:FormPanel>
                     <ext:FormPanel ID   ="FormPanel3" runat="server" Region="Center" Layout="Fit"     Title  ="Documentos Devueltos" 
                                    Icon ="NoteAdd" >
                            <Items>  
                                             <ext:GridPanel
                                                    ID="gpDevueltos"
                                                    runat="server"                                           
                                                    Height="90">
                                                       <Store>
                                                        <ext:Store ID="Store3" runat="server">
                                                            <Model>
                                                                <ext:Model ID="Model3" runat="server" IDProperty="Id">
                                                                    <Fields>
                                                                        <ext:ModelField Name="Fecha" Type="Date" />
                                                                        <ext:ModelField Name="ExpedienteId" Type="String" />
                                                                        <ext:ModelField Name="ExpedienteNombre" Type="String" />
                                                                        <ext:ModelField Name="FaseNombre" Type="String" />
                                                                        <ext:ModelField Name="FaseId" Type="String" />
                                                                        <ext:ModelField Name="JefeturaNombre" Type="String" />
                                                                        <ext:ModelField Name="JefeturaCodigo" Type="String" /> 
                                                                        <ext:ModelField Name="FaseCodigo" Type="String" />
                                                                        <ext:ModelField Name="FaseLicId" Type="String" />
                                                                        <ext:ModelField Name="FaseId" Type="String" />
                                                                        <ext:ModelField Name="EstadoFase" Type="String" /> 
                                                                        <ext:ModelField Name="ListaTecnicos" Type="String" />                                                               
                                                                    </Fields>
                                                                </ext:Model>
                                                            </Model>                                      
                                                            <Proxy>
                                                                <ext:PageProxy DirectFn="App.direct.BindDataDevueltos">
                                                                    <Reader>
                                                                        <ext:JsonReader></ext:JsonReader>
                                                                    </Reader>
                                                                </ext:PageProxy>
                                                            </Proxy>
                                                        </ext:Store>
                                                    </Store>
                                                    <ColumnModel ID="ColumnModel3" runat="server">
                                                        <Columns>
                                                            <ext:Column ID="Column5"  runat="server" Text="Id" DataIndex="Id" Flex="1" Hidden="true"/>
                                                            <ext:DateColumn ID="DateColumn2" runat="server" Text="Fecha" Width="95" DataIndex="Fecha" Format="dd-m-yy" />                                                        
                                                            <ext:Column ID="Column7"  runat="server" Text="Expediente" DataIndex="ExpedienteNombre" />
                                                            <ext:Column ID="Column8"  runat="server" Text="Fase" DataIndex="FaseNombre" /> 
                                                            <ext:Column ID="Column10"  runat="server" Text="Técnicos" DataIndex="ListaTecnicos" Flex="1"/>                                                                                                                     
                                                        </Columns>                                                    
                                                    </ColumnModel>          
                                                </ext:GridPanel>
                                                  
                          
                            </Items>
                       
                           <BottomBar>
                             <ext:StatusBar 
                                    ID="StatusBar3" 
                                    runat="server"
                                    StatusAlign="Left">
                                    <Items>                                
                                        <ext:ToolbarTextItem ID="ToolbarTextItem3" runat="server" Text="" Cls="ux-bold-text-item"  Margin="15"/>
                                    </Items>
                                </ext:StatusBar>
                            </BottomBar>
               </ext:FormPanel>
              </Items>
            </ext:TabPanel>
            </Items> 
         </ext:FormPanel>
        </Items>
       </ext:Viewport>
    </form>
    <ext:XScript ID="XScript1" runat="server">
        <script type="text/javascript">
            var pgFn = new Object();
            pgFn.ShwoAllDoc= function (record) {
                try 
                { 
                    App.direct.ShowAllFiles(record.data.TablaId,record.data.Tabla,{
                        success: function (result) {
                           
                        },
                        eventMask: {
                            showMask: true,
                            minDelay: 500
                        }
                    });
                }
                catch (jsbug){
                    AppGlobalJs.showBug("pgFn.ShwoAllDoc: " + jsbug);
                }
            };
            pgFn.DevolverProce = function (record) {
                try
                {   
                    Ext.Msg.confirm('Alerta de confirmación', 'Este proceso se devolvera a la subdireción, Esta segura de realizar esta acción ?', function (btn) {
                        if (btn == 'yes') 
                        {  
                            var gridDataSelect2=#{gpDocumentosLoad}.getRowsValues({selectedOnly:true});
                            App.direct.pgJefeDep.UpdateEstado(gridDataSelect2[0].Id,
                            {
                                    success: function (result) 
                                    {
                                                   
                                    },
                                    eventMask: 
                                    {
                                        showMask: true,
                                        minDelay: 500
                                    }
                            });
                        }                     
                  } );  
                   
                
                } catch (jsbug) {
                    AppGlobalJs.showBug("pgFn.DevolverProce: " + jsbug)
                }
            };    
            pgFn.ShowProc = function (record) {
                try
                { 
                    #{forPanelProc}.getForm().loadRecord(record);
                    App.direct.pgJefeDep.ShowTarea(Ext.encode(record.data),
                     {
                               success: function (result) 
                               {

                               },
                               eventMask: 
                               {
                                   showMask: true,
                                   minDelay: 500
                               }
                     });
                  

                } catch (jsbug) {
                    AppGlobalJs.showBug("pgFn.ShowProc: " + jsbug)
                }
            };   
             
       </script>
    </ext:XScript>     
</body>


</html>
